package ds.factcom.domain.item;

import ds.factcom.domain.Domain;
import ds.factcom.domain.product.Product;

/**
 * @author Javier De Luca, Maximiliano Herrera, Matias Samblancat
 */
public class Item extends Domain{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -8137601697809997778L;

	private static Integer lastId = 0;
	
	private Float unitPrice;
	private int cant;
	private Product product;
	
	public Item(Product p, int c) {
		lastId = this.generateId();
		this.setId(lastId);
		this.unitPrice = p.getPrice();
		this.cant = c;
		this.product = p;
	}

	public Float getUnitPrice(){
		return unitPrice;
	}
	public int getCant(){
		return cant;
	} 
	
	public Float getTotalPrice(){
		return cant * unitPrice;
	}
	
	public Product getProduct(){
		return product;
	}
	
	@Override
	protected Integer getLastId() {
		return lastId;
	}
}
